﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class AudioControl : MonoBehaviour {

    public static AudioControl Instance;

    public AudioSource[] LoginAudio;
    public AudioSource[] Level1Audio;
    public AudioSource[] Level2Audio;
    public AudioSource[] Level3Audio;
    public AudioSource[] Level4Audio;
    public AudioSource[] Level5Audio;
    public AudioSource[] Level6Audio;
    public AudioSource[] Level7Audio;

    // Use this for initialization
    void Start ()
    {
        Instance = this;

        int n = PlayerPrefs.GetInt("MusicNum",0);
        if (n==1)
        {
            string name = SceneManager.GetActiveScene().name;
            switch (name)
            {
                case "Login":
                    for (int i = 0; i < LoginAudio.Length; i++)
                    {
                        LoginAudio[i].enabled = false;
                    }
                    break;
                case "001":
                    for (int i = 0; i < Level1Audio.Length; i++)
                    {
                        Level1Audio[i].enabled = false;
                    }
                    break;
                case "002":
                    for (int i = 0; i < Level2Audio.Length; i++)
                    {
                        Level2Audio[i].enabled = false;
                    }
                    break;
                case "003":
                    for (int i = 0; i < Level3Audio.Length; i++)
                    {
                        Level3Audio[i].enabled = false;
                    }
                    break;
                case "004":
                    for (int i = 0; i < Level4Audio.Length; i++)
                    {
                        Level4Audio[i].enabled = false;
                    }
                    break;
                case "005":
                    for (int i = 0; i < Level5Audio.Length; i++)
                    {
                        Level5Audio[i].enabled = false;
                    }
                    break;
                case "006":
                    for (int i = 0; i < Level6Audio.Length; i++)
                    {
                        Level6Audio[i].enabled = false;
                    }
                    break;
                case "007":
                    for (int i = 0; i < Level7Audio.Length; i++)
                    {
                        Level7Audio[i].enabled = false;
                    }
                    break;
                default:
                    break;
            }
        }
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
